package com.huisou.solrj;

import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.impl.XMLResponseParser;

public class SolrServerUtil {
	private static String	url	= "http://localhost:8083/";
	
	public static HttpSolrServer getSolrServer(String solrcore) {
		HttpSolrServer server = null;
		
		try {
			server = new HttpSolrServer(url + solrcore);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		server.setSoTimeout(10000);
		server.setConnectionTimeout(10000);
		server.setDefaultMaxConnectionsPerHost(1000);
		server.setMaxTotalConnections(1000);
		server.setFollowRedirects(false);
		server.setAllowCompression(true);
		server.setMaxRetries(1);
		server.setParser(new XMLResponseParser());
		
		return server;
	}
}
